﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Alos.Entity;
using Alos.IRepository;
using PetaPoco;

namespace Alos.Repository
{
   public class ReExamDetailRepository : BaseRepository<ReExamDetail>, IReExamDetailRepository
    {
        /// <summary>
        /// 添加学生试题答题详情记录表
        /// </summary>
        /// <param name="ReExamDetail">学生试题答题详情记录表</param>
        /// <returns></returns>
       public bool CreatReExamDetail(ReExamDetail ReExamDetail)
       {
           return Convert.ToInt32(ReExamDetail.Insert()) > 0 ? true : false;
       }

       /// <summary>
       /// 添加答案详情
       /// </summary>
       /// <param name="lRed"></param>
       /// <returns></returns>
       public bool Add(List<ReExamDetail> lRed)
       {
           try
           {
               DBContext.BeginTransaction();
               lRed.ForEach(red =>
               {
                   DBContext.Insert(red);
               });
               DBContext.CompleteTransaction();
               return true;
           }
           catch( Exception ex)
           {
               Common.Log.errorlog(ex);
               return false;
           }
       }
    }
}
